<?php
/**
 * Created by PhpStorm.
 * User: geyouwen
 * Date: 17/2/15
 * Time: 上午11:28
 */

namespace App\Model\Dao;


use Illuminate\Support\Facades\DB;
use Jenssegers\Mongodb\Eloquent\Model;


class MongoMember extends Model
{
    protected $connection = 'mongodb';

    protected $collection = 'member';

    protected $mongodb;

    public function __construct()
    {
        $this->mongodb = DB::connection($this->connection);
    }



    public function distance($option)
    {
        $data = $this->mongodb->command($option);
        return $data->toArray()[0]['results'];
    }

    public function getData()
    {
      return $this->take(2)->get();
    }

}